Part Number Hot Search : 
TYPES TYPES 60601B IRL2505 BAS70W H0101001 3454VT HMU1345
Product Description
Full Text Search
 

To Download AT89S8253-24SC Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  features ? compatible with mcs ? -51 products  12k bytes of in-system programmable (isp) flash program memory ? spi serial interface for program downloading ? endurance: 10,000 write/erase cycles  2k bytes eeprom data memory ? endurance: 100,000 write/erase cycles  64-byte user signature array  2.7v to 5.5v operating range  fully static operation: 0 hz to 24 mhz  three-level program memory lock  256 x 8-bit internal ram  32 programmable i/o lines  three 16-bit timer/counters  nine interrupt sources  enhanced uart serial port with framing error detection and automatic address recognition  enhanced spi (double write/read buffered) serial interface  low-power idle and power-down modes  interrupt recovery from power-down mode  programmable watchdog timer  dual data pointer  power-off flag  flexible isp programming (byte and page modes) ? page mode: 64 bytes/page for code memory, 32 bytes/page for data memory  four-level enhanced interrupt controller  programmable and fuseable x2 clock option  internal power-on reset  42-pin pdip package option for reduced emc emission  green (pb/halide-free) packaging option 1. description the at89s8253 is a low-power, high-performance cmos 8-bit microcontroller with 12k bytes of in-system programmable (isp) flash program memory and 2k bytes of eeprom data memory. the device is manufactured using atmel?s high-density non- volatile memory technology and is compatible with the industry-standard mcs-51 instruction set and pinout. the on-chip downloadable flash allows the program mem- ory to be reprogrammed in-system through an spi serial interface or by a conventional nonvolatile memory programmer. by combining a versatile 8-bit cpu with downloadable flash on a monolithic chip, the atmel at89s8253 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. 3286h?micro?9/05 8-bit microcontroller with 12k bytes flash and 2k bytes eeprom at89s8253
2 3286h?micro?9/05 at89s8253 the at89s8253 provides the following standard features: 12k bytes of in-system programma- ble flash, 2k bytes of eeprom, 256 bytes of ram, 32 i/o lines, programmable watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector, four-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. in addition, the at89s8253 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. the idle mode stops the cpu while allowing the ram, timer/counters, serial port, and interrupt system to continue functioning. the power-down mode saves the ram contents but freezes the oscillator, disabling all other chip functions until the next external inter- rupt or hardware reset. the on-board flash/eeprom is accessible through the spi serial interface. holding reset active forces the spi bus into a serial programming interface and allows the program memory to be written to or read from, unless one or more lock bits have been activated. 2. pin configurations 2.1 40p6 ? 40-lead pdip 2.2 44a ? 44-lead tqfp 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 (t2) p1.0 (t2 ex) p1.1 p1.2 p1.3 (ss) p1.4 (mosi) p1.5 (miso) p1.6 (sck) p1.7 rst (rxd) p3.0 (txd) p3.1 (int0) p3.2 (int1) p3.3 (t0) p3.4 (t1) p3.5 (wr) p3.6 (rd) p3.7 xtal2 xtal1 gnd vcc p0.0 (ad0) p0.1 (ad1) p0.2 (ad2) p0.3 (ad3) p0.4 (ad4) p0.5 (ad5) p0.6 (ad6) p0.7 (ad7) ea/vpp ale/prog psen p2.7 (a15) p2.6 (a14) p2.5 (a13) p2.4 (a12) p2.3 (a11) p2.2 (a10) p2.1 (a9) p2.0 (a8) 1 2 3 4 5 6 7 8 9 10 11 33 32 31 30 29 28 27 26 25 24 23 44 43 42 41 40 39 38 37 36 35 34 12 13 14 15 16 17 18 19 20 21 22 (mosi) p1.5 (miso) p1.6 (sck) p1.7 rst (rxd) p3.0 nc (txd) p3.1 (int0) p3.2 (int1) p3.3 (t0) p3.4 (t1) p3.5 p0.4 (ad4) p0.5 (ad5) p0.6 (ad6) p0.7 (ad7) ea/vpp nc ale/prog psen p2.7 (a15) p2.6 (a14) p2.5 (a13) p1.4 (ss) p1.3 p1.2 p1.1 (t2 ex) p1.0 (t2) nc vcc p0.0 (ad0) p0.1 (ad1) p0.2 (ad2) p0.3 (ad3) (wr) p3.6 (rd) p3.7 xtal2 xtal1 gnd gnd (a8) p2.0 (a9) p2.1 (a10) p2.2 (a11) p2.3 (a12) p2.4
3 3286h?micro?9/05 at89s8253 2.3 44j ? 44-lead plcc 2.4 42ps6 ? pdip 3. pin description 3.1 vcc supply voltage (all packages except 42-pdip). 3.2 gnd ground (all packages except 42-pdip; for 42-pd ip gnd connects only t he logic core and the embedded program/data memories). 3.3 vdd supply voltage for the 42-pdip which connects only the logic core and the embedded pro- gram/data memories. 3.4 pwrvdd supply voltage for the 42-pdip which connects only the i/o pad drivers. the application board must connect both vdd and pwrvdd to the board supply voltage. 7 8 9 10 11 12 13 14 15 16 17 39 38 37 36 35 34 33 32 31 30 29 (mosi) p1.5 (miso) p1.6 (sck) p1.7 rst (rxd) p3.0 nc (txd) p3.1 (int0) p3.2 (int1) p3.3 (t0) p3.4 (t1) p3.5 p0.4 (ad4) p0.5 (ad5) p0.6 (ad6) p0.7 (ad7) ea/vpp nc ale/prog psen p2.7 (a15) p2.6 (a14) p2.5 (a13) 6 5 4 3 2 1 44 43 42 41 40 18 19 20 21 22 23 24 25 26 27 28 (wr) p3.6 (rd) p3.7 xtal2 xtal1 gnd nc (a8) p2.0 (a9) p2.1 (a10) p2.2 (a11) p2.3 (a12) p2.4 p1.4 (ss) p1.3 p1.2 p1.1 (t2 ex) p1.0 (t2) nc vcc p0.0 (ad0) p0.1 (ad1) p0.2 (ad2) p0.3 (ad3) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 rst (rxd) p3.0 (txd) p3.1 (int0) p3.2 (int1) p3.3 (t0) p3.4 (t1) p3.5 (wr) p3.6 (rd) p3.7 xtal2 xtal1 gnd pwrgnd (a8) p2.0 (a9) p2.1 (a10) p2.2 (a11) p2.3 (a12) p2.4 (a13) p2.5 (a14) p2.6 (a15) p2.7 p1.7 (sck) p1.6 (miso) p1.5 (mosi) p1.4 (ss) p1.3 p1.2 p1.1 (t2ex) p1.0 (t2) vdd pwrvdd p0.0 (ad0) p0.1 (ad1) p0.2 (ad2) p0.3 (ad3) p0.4 (ad4) p0.5 (ad5) p0.6 (ad6) p0.7 (ad7) ea/vpp ale/prog psen
4 3286h?micro?9/05 at89s8253 3.5 pwrgnd ground for the 42-pdip which connects only the i/o pad drivers. pwrgnd and gnd are weakly connected through the comm on silicon substrate, but not through any metal links. the application board must connect both gnd and pwrgnd to the board ground. 3.6 port 0 port 0 is an 8-bit open drain bi-directional i/o port. as an output port, each pin can sink six ttl inputs. when 1s are written to port 0 pins, the pins can be used as high-impedance inputs. port 0 can also be configured to be the multiplexed low-order address/data bus during accesses to external program and data memory. in this mode, p0 has internal pull-ups. port 0 also receives the code bytes during flash programming and outputs the code bytes dur- ing program verification. external pull-ups are required during program verification. 3.7 port 1 port 1 is an 8-bit bi-directional i/o port with internal pull-ups. the port 1 output buffers can sink/source six ttl inputs. when 1s are written to port 1 pins, they are pulled high by the weak internal pull-ups and can be used as inputs. as i nputs, port 1 pins that are externally being pulled low will source current (i il ,150 a typical) because of the weak internal pull-ups. some port 1 pins provide additional functions . p1.0 and p1.1 can be configured to be the timer/counter 2 external count input (p1.0/t2) and the timer/counter 2 trigger input (p1.1/t2ex), respectively. furthermore, p1.4, p1.5, p1.6, and p1.7 can be configured as the spi slave port select, data input/output and shift clock input/output pins as shown in the following table. port 1 also receives the low-order address bytes during flash programming and verification. 3.8 port 2 port 2 is an 8-bit bi-directional i/o port with internal pull-ups. the port 2 output buffers can sink/source six ttl inputs. when 1s are written to port 2 pins, they are pulled high by the weak internal pull-ups and can be used as inputs. as i nputs, port 2 pins that are externally being pulled low will source current (i il ,150 a typical) because of the weak internal pull-ups. port 2 emits the high-order address byte during fetches from external program memory and dur- ing accesses to external data memory that use 16-bit addresses (movx @ dptr). in this application, port 2 uses strong internal pull-ups when emitting 1s. during accesses to external data memory that use 8-bit addresses (movx @ ri), port 2 emits the contents of the p2 special function register. port 2 also receives the high-order address bits and some control signals during flash programming and verification. port pin alternate functions p1.0 t2 (external count input to timer/counter 2), clock-out p1.1 t2ex (timer/counter 2 capture/reload trigger and direction control) p1.4 ss (slave port select input) p1.5 mosi (master data output, slave data input pin for spi channel) p1.6 miso (master data input, slave data output pin for spi channel) p1.7 sck (master clock output, slave clock input pin for spi channel)
5 3286h?micro?9/05 at89s8253 3.9 port 3 port 3 is an 8-bit bi-directional i/o port with internal pull-ups. the port 3 output buffers can sink/source six ttl inputs. when 1s are written to port 3 pins, they are pulled high by the weak internal pull-ups and can be used as inputs. as i nputs, port 3 pins that are externally being pulled low will source current (i il ,150 a typical) because of the weak internal pull-ups. port 3 receives some control signals for flash programming and verification. port 3 also serves the functions of various special features of the at89s8253, as shown in the following table. note: 1. all pins in ports 1 and 2 and almost all pins in port 3 (the exceptions are p3.2 int0 and p3.3 int1 ) have their weak internal pull-ups disabled in the power-down mode. port pins p3.2 (int0 ) and p3.3 (int1 ) are active even in power-down mode (to be able to sense an interrupt request to exit the power-down mode) and as such still have their weak internal pull-ups turned on. 3.10 rst reset input. a high on this pin for at least two machine cycles while the oscillator is running resets the device. 3.11 ale/prog address latch enable. ale/prog is an output pulse for latching the low byte of the address (on its falling edge) during accesses to external memory. this pin is also the program pulse input (prog ) during flash programming. in normal operation, ale is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. note, however, that one ale pulse is skipped dur- ing each access to external data memory. if desired, ale operation can be disabled by setting bit 0 of the auxr sfr at location 8eh. with the bit set, ale is active only during a movx or movc instruction. otherwise, the pin is weakly pulled high. setting the ale-disable bit has no effect if the microcontroller is in external execu- tion mode. 3.12 psen program store enable. psen is the read strobe to external program memory (active low). when the at89s8253 is execut ing code from external program memory, psen is activated twice each machine cycle, except that two psen activations are skipped during each access to external data memory. port pin alternate functions p3.0 rxd (serial input port) p3.1 txd (serial output port) p3.2 int0 (external interrupt 0) (1) p3.3 int1 (external interrupt 1) (1) p3.4 t0 (timer 0 external input) p3.5 t1 (timer 1 external input) p3.6 wr (external data memory write strobe) p3.7 rd (external data memory read strobe)
6 3286h?micro?9/05 at89s8253 3.13 ea /vpp external access enable. ea must be strapped to gnd in order to enable the device to fetch code from external program memory locations starting at 0000h up to ffffh. note, however, that if lock bit 1 is programmed, ea will be internally latched on reset. ea should be strapped to v cc for internal program executions. this pin also receives the 12-volt programming enable voltage (v pp ) during flash programming when 12-volt programming is selected. 3.14 xtal1 input to the inverting oscillator amplifier and input to the internal clock operating circuit. 3.15 xtal2 output from the inverting oscillator amplifier. 4. block diagram port 2 drivers port 2 latch p2.0 - p2.7 flash port 0 latch ram eeprom program address register buffer pc incrementer program counter dual dptr instruction register b register interrupt, serial port, and timer blocks stack pointer acc tmp2 tmp1 alu psw timing and control port 1 drivers p1.0 - p1.7 port 3 latch port 3 drivers p3.0 - p3.7 osc gnd v cc psen ale/prog ea / v pp rst ram addr. register port 0 drivers p0.0 - p0.7 port 1 latch watch dog spi port program logic
7 3286h?micro?9/05 at89s8253 5. special function registers a map of the on-chip memory area called the special function register (sfr) space is shown in table 5-1 . note that not all of the addresses are occupied, and unoccupied addresses may not be imple- mented on the chip. read accesses to these addresses will generally return random data, and write accesses will have an indeterminate effect. user software should not write 1s to these unlisted locations, since they may be used in future products to invoke new features. in that case, the reset or inactive values of the new bits will always be 0. note: # means: 0 after cold reset and unchanged after warm reset. table 5-1. at89s8253 sfr map and reset values 0f8h 0ffh 0f0h b 00000000 0f7h 0e8h 0efh 0e0h acc 00000000 0e7h 0d8h 0dfh 0d0h psw 00000000 spcr 00000100 0d7h 0c8h t2con 00000000 t2mod xxxxxx00 rcap2l 00000000 rcap2h 00000000 tl2 00000000 th2 00000000 0cfh 0c0h 0c7h 0b8h ip xx000000 saden 00000000 0bfh 0b0h p3 11111111 iph xx000000 0b7h 0a8h ie 0x000000 saddr 00000000 spsr 000xxx00 0afh 0a0h p2 11111111 wdtrst (write only) wdtcon 0000 0000 0a7h 98h scon 00000000 sbuf xxxxxxxx 9fh 90h p1 11111111 eecon xx000011 97h 88h tcon 00000000 tmod 00000000 tl0 00000000 tl1 00000000 th0 00000000 th1 00000000 auxr xxxxxxx0 clkreg xxxxxxx0 8fh 80h p0 11111111 sp 00000111 dp0l 00000000 dp0h 00000000 dp1l 00000000 dp1h 00000000 spdr ######## pcon 00xx0000 87h
8 3286h?micro?9/05 at89s8253 5.1 auxiliary register the auxr register contains a single active bit called disale. 5.2 clock register the clkreg register contains a single active bit called x2. 5.3 spi registers control and status bits for the serial peripheral interface are contained in registers spcr (see table 14-1 on page 25 ) and spsr (see table 14-2 on page 26 ). the spi data bits are contained in the spdr register. in normal spi mode, writing the spi data register during serial data trans- fer sets the write collision bit (wcol) in the spsr register. in enhanced spi mode, the spdr is also write double-buffered because wcol works as a write buffer full flag instead of being a collision flag. the values in spdr are not changed by reset. 5.4 interrupt registers the global interrupt enable bit and the individual inte rrupt enable bits are in the ie register. in addition, the individual interrupt enable bit for the spi is in the spcr register. four priorities can be set for each of the six interrupt sources in the ip and iph registers. iph bits have the same functions as ip bits, except iph has higher priority than ip. by using iph in conjunction with ip, a priority level of 0, 1, 2, or 3 may be set for each interrupt. table 5-2. auxr ? auxiliary register auxr address = 8eh reset value = xxxx xxx0b not bit addressable ? ? ? ? ? ? intel_pwd_exit disale bit765432 1 0 symbol function disale when disale = 0, ale is emitted at a constant rate of 1/6 the oscillator frequency (except during movx when 1 ale pulse is missing). when disale = 1, ale is active only during a movx or movc instruction. intel_pwd_exit when set, this bit configures the interrupt driven exit from power-down to resume execution on the rising edge of the interrupt signal. when this bit is cleared, the execution resumes after a self-timed interval (nominal 2 ms) referenced from the falling edge of the interrupt signal. table 5-3. clkreg ? clock register clkreg address = 8fh reset value = xxxx xxx0b not bit addressable ???????x2 bit76543210 symbol function x2 when x2 = 0, the oscillator frequency (at xtal1 pin) is internally divided by 2 before it is used as the device system frequency. when x2 = 1, the divider by 2 is no longer used and the xtal1 frequency becomes the device system frequency. this enables the user to choose a 6 mhz crystal instead of a 12 mhz crystal, for example, in order to reduce emi.
9 3286h?micro?9/05 at89s8253 5.5 dual data pointer registers to facilitate accessing both internal eeprom and external data memory, two banks of 16-bit data pointer registers are provided: dp0 at sfr address locations 82h - 83h and dp1 at 84h - 85h. bit dps = 0 in sfr eecon selects dp0 and dps = 1 selects dp1. the user should always initialize the dps bit to the appropriate value before accessing the respective data pointer register. 5.6 power off flag the power off flag (pof), located at bit_4 (pcon.4) in the pcon sfr. pof, is set to ?1? dur- ing power up. it can be set and reset under software control and is not affected by reset. 6. data memory ? eeprom and ram the at89s8253 implements 2k bytes of on-chip eeprom for data storage and 256 bytes of ram. the upper 128 bytes of ram occupy a parallel space to the special function registers. that means the upper 128 bytes have the same addresses as the sfr space but are physically separate from sfr space. when an instruction accesses an internal location above address 7fh, the address mode used in the instruction specifies whether the cpu accesses the upper 128 bytes of ram or the sfr space. instructions that use direct addressing access the sfr space. for example, the following direct addressing instruction accesses the sfr at location 0a0h (which is p2). mov 0a0h, #data instructions that use indirect addressing access the upper 128 bytes of ram. for example, the following indirect addressing instruction, where r0 contains 0a0h, accesses the data byte at address 0a0h, rather than p2 (whose address is 0a0h). mov @r0, #data note that stack operations are examples of indirect addressing, so the upper 128 bytes of data ram are available as stack space. the on-chip eeprom data memory is selected by setting the eemen bit in the eecon register at sfr address location 96h. the eeprom address range is from 000h to 7ffh. movx instructions are used to access the eeprom. to access off-chip data memory with the movx instructions, the eemen bit needs to be set to ?0?. during program execution mode (using the movx instruction) there is an auto-erase capability at the byte level. this means that the user can update or modify a single eeprom byte location in real-time without affecting any other bytes. the eemwe bit in the eecon register needs to be set to ?1? before any byte location in the eeprom can be written. user so ftware should reset eemwe bit to ?0? if no further eeprom write is required. eeprom write cycles in the serial programming mode are self-timed and typi- cally take 4 ms. the progress of eeprom write can be monitored by reading the rdy/bsy bit (read-only) in sfr eecon. rdy/bsy = 0 means programming is still in progress and rdy/bsy = 1 means an eeprom write cycle is completed and another write cycle can be initiated. bit eeld in eecon controls whether the next movx instruction will only load the write buffer of the eeprom or will actually start the programming cycle. by setting eeld, only load will occur. before the last movx in a given page of 32 bytes, eeld should be cleared so that after the last movx the entire page will be programmed at the same time. this way, 32 bytes will only require 4 ms of programming time instead of 128 ms required in single byte programming.
10 3286h?micro?9/05 at89s8253 in addition, during eeprom programming, an attempted read from the eeprom will fetch the byte being written with the msb complemented. once the write cycle is completed, true data are valid at all bit locations. 6.1 memory control register the eecon register contains control bits for the 2k bytes of on-chip data eeprom. it also con- tains the control bit for the dual data pointer. figure 6-1. data eeprom write sequence table 6-1. eecon ? data eeprom control register eecon address = 96h reset value = xx00 0011b not bit addressable bit ? ? eeld eemwe eemen dps rdy/bsy wrtinh 765432 1 0 symbol function eeld eeprom data memory load enable bit. used to implement page mode write. a movx instruction writing into the data eeprom will not initiate the programming cycle if this bit is set, rather it will just load data into the volatile data buffer of the data eeprom memory. before the last movx, reset this bit and the data eeprom will program all the bytes previously loaded on the same page of the address given by the last movx instruction. eemwe eeprom data memory write enable bit. set this bit to 1 before initiating byte write to on-chip eeprom with the movx instruction. user software should set this bit to 0 after eeprom write is completed. eemen internal eeprom access enable. when eemen = 1, the movx instruction with dptr will access on-chip eeprom instead of external data memory if the address used is less than 2k. when eemen = 0 or the address used is 2k, movx with dptr accesses external data memory. dps data pointer register select. dps = 0 selects the first bank of data pointer register, dp0, and dps = 1 selects the second bank, dp1. rdy/bsy rdy/bsy (ready/busy ) flag for the data eeprom memory. this is a read-only bit which is cleared by hardware during the programming cycle of the on-chip eeprom. it is also set by hardware when the programming is completed. note that rdy/bsy will be cleared long after the completion of the movx instruction which has initiated the programming cycle. wrtinh wrtinh (write inhibit) is a read-only bit which is cleared by hardware when v cc is too low for the programming cycle of the on-chip eeprom to be executed. when this bit is cleared, an ongoing programming cycle will be aborted or a new programming cycle will not start. 012 33 0 3 1 eemwe eemen eeld movx data rdy/b s y 4 m s ~
11 3286h?micro?9/05 at89s8253 7. power-on reset a power-on reset (por) is generated by an on-chip detection circuit. the detection level is nominally 1.4v. the por is activated whenever v cc is below the detection level. the por cir- cuit can be used to trigger the start-up reset or to detect a supply voltage failure in devices without a brown-out detector. the por circuit en sures that the device is reset from power-on. when v cc reaches the power-on reset threshold vo ltage, the por delay counter determines how long the device is kept in por after v cc rise, nominally 2 ms. the por signal is activated again, without any delay, when v cc falls below the por threshold level. a power-on reset (i.e. a cold reset) will set the pof flag in pcon. figure 7-1. power-up and brown-out detection sequence 7.1 brown-out reset the at89s8253 has an on-chip brown-out detection (bod) circuit for monitoring the v cc level during operation by comparing it to a fixed trigger level of 2.4v (max). the trigger level for the bod is nominally 2.2v. the purpose of the bod is to ensure that if v cc fails or dips while exe- cuting at speed, the system will gracefully enter reset without the possibility of errors induced by incorrect execution. when v cc decreases to a value below the trigger level, the brown-out reset is immediately activated. when v cc increases above the trigger level, the bod delay counter starts the mcu after the timeout period has expired in approximately 2 ms. por por level 1.4v bod level 2. 3 v min v cc level 2.7v xtal1 bod intern a l re s et t t t t t v cc t por (2 m s ) t por (2 m s ) 2.4v 1.2v 0
12 3286h?micro?9/05 at89s8253 8. programmable watchdog timer the programmable watchdog timer (wdt) counts instruction cycles. the prescaler bits, ps0, ps1 and ps2 in sfr wdtcon are used to set the period of the watchdog timer from 16k to 2048k instruction cycles. the available timer periods are shown in table 8-1 . the wdt time-out period is dependent upon the external clock frequency. the wdt is disabled by power-on reset and during power-down mode. when wdt times out without being serviced or disabled, an internal rst pulse is generated to reset the cpu. see table 8-1 for the wdt period selections. table 8-1. watchdog timer time-out period selection wdt prescaler bits period (nominal for f clk = 12 mhz) ps2 ps1 ps0 000 16 ms 001 32 ms 010 64 ms 011 128 ms 100 256 ms 101 512 ms 1 1 0 1024 ms 1 1 1 2048 ms
13 3286h?micro?9/05 at89s8253 8.1 watchdog control register the wdtcon register contains control bits for the watchdog timer (shown in table 8-2 ). figure 8-1. software mode ? watchdog timer sequence table 8-2. wdtcon ? watchdog control register wdtcon address = a7h reset value = 0000 0000b not bit addressable ps2 ps1 ps0 wdidle disrto hwdt wswrst wdten bit76543210 symbol function ps2 ps1 ps0 prescaler bits for the watchdog timer (wdt). when all three bits are cleared to 0, the watchdog timer has a nominal period of 16k machine cycles, (i.e. 16 ms at a xtal frequency of 12 mhz in normal mode or 6 mhz in x2 mode). when all three bits are set to 1, the nominal period is 2048k machine cycles, (i.e. 2048 ms at 12 mhz clock frequency in normal mode or 6 mhz in x2 mode). wdidle enable/disable the watchdog timer in idle mode. when wdidle = 0, wdt continues to count in idle mode. when wdidle = 1, wdt freezes while the device is in idle mode. disrto enable/disable the wdt-driven reset out (wdt drives the rst pin). when disrto = 0, the rst pin is driven high after wdt times out and the entire board is reset. when disrto = 1, the rst pin remains only as an input and the wdt resets only the microcontroller internally after wdt times out. hwdt hardware mode select for the wdt. when hwdt = 0, the wdt can be turned on/off by simply setting or clearing wdten in the same register (this is the software mode for wdt). when hwdt = 1, the wdt has to be set by writing the sequence 1eh/e1h to the wdtrst register (with address 0a6h) and after being set in this way, wdt cannot be turned off except by reset, warm or cold (this is the hardware mode for wdt). to prevent the hardware wdt from resetting the entire device, the same sequence 1eh/e1h must be written to the same wdtrst sfr before the timeout interval. wswrst watchdog software reset bit. if hwdt = 0 (i.e. wdt is in software controlled mode), when set by software, this bit resets wdt. after being set by software, wswrst is reset by hardware during the next machine cycle. if hwdt = 1, this bit has no effect, and if set by software, it will not be cleared by hardware. wdten watchdog software enable bit. when hwdt = 0 (i.e. wdt is in software-controlled mode), this bit enables wdt when set to 1 and disables wdt when cleared to 0 (it does not reset wdt in this case, but just freezes the existing counter state). if hwdt = 1, this bit is read-only and reflects the status of the wdt (whether it is running or not). wdten w s wr s t hw hw s w s w write s a 1
14 3286h?micro?9/05 at89s8253 9. timer 0 and 1 timer 0 and timer 1 in the at89s8253 operate the same way as timer 0 and timer 1 in the at89s51 and at89s52. for more detailed information on the timer/counter operation, please click on the document link below: http://www.atmel.com/dyn/resources/prod_documents/doc4316.pdf 10. timer 2 timer 2 is a 16-bit timer/counter that can operate as either a timer or an event counter. the type of operation is selected by bit c/t2 in the sfr t2con (see table 10-2 on page 15 ). timer 2 has three operating modes: capture, auto-reload (up or down counting), and baud rate gener- ator. the modes are selected by bits in t2con, as shown in table 10-2 . timer 2 consists of two 8-bit registers, th2 and tl2. in the timer function, the tl2 register is incremented every machine cycle. since a machin e cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscillator frequency. in the counter function, the register is incremented in response to a 1-to-0 transition at its corre- sponding external input pin, t2. in this function, the external input is sampled during s5p2 of every machine cycle. when the samples show a high in one cycle and a low in the next cycle, the count is incremented. the new count value appears in the register during s3p1 of the cycle following the one in which the transition was det ected. since two machine cycles (24 oscillator periods) are required to recognize a 1-to-0 transi tion, the maximum count rate is 1/24 of the oscillator frequency. to ensure that a given level is sampled at least once before it changes, the level should be held for at least one full machine cycle. table 10-1. timer 2 operating modes rclk + tclk cp/rl2 tr2 mode 0 0 1 16-bit auto-reload 0 1 1 16-bit capture 1 x 1 baud rate generator x x 0 (off)
15 3286h?micro?9/05 at89s8253 10.1 timer 2 registers control and status bits are contained in registers t2con (see table 10-2 ) and t2mod (see table 10-3 ) for timer 2. the register pair (rcap2h, rcap2l) are the capture/reload registers for timer 2 in 16-bit capture mode or 16-bit auto-reload mode. 10.2 capture mode in the capture mode, two options are selected by bit exen2 in t2con. if exen2 = 0, timer 2 is a 16-bit timer or counter which upon overflow sets bit tf2 in t2con. this bit can then be used to generate an interrupt. if exen2 = 1, timer 2 performs the same operation, but a 1-to-0 transi- tion at external input t2ex also causes the current value in th2 and tl2 to be captured into rcap2h and rcap2l, respectively. in addition, the transition at t2ex causes bit exf2 in t2con to be set. the exf2 bit, like tf2, can generate an interrupt. the capture mode is illus- trated in figure 10-1 . table 10-2. t2con ? timer/counter 2 control register t2con address = 0c8h reset value = 0000 0000b bit addressable tf2 exf2 rclk tclk exen2 tr2 c/t2 cp/rl2 bit76543210 symbol function tf2 timer 2 overflow flag set by a timer 2 overflow and must be cleared by software. tf2 will not be set when either rclk = 1 or tclk = 1. exf2 timer 2 external flag set when either a capture or reload is caused by a negative transition on t2ex and exen2 = 1. when timer 2 interrupt is enabled, exf2 = 1 will cause the cpu to vector to the timer 2 interrupt routine. exf2 must be cleared by software. exf2 does not cause an interrupt in up/down counter mode (dcen = 1). rclk receive clock enable. when set, causes the serial port to use timer 2 overflow pulses for its receive clock in serial port modes 1 and 3. rclk = 0 causes timer 1 overflows to be used for the receive clock. tclk transmit clock enable. when set, causes the serial port to use timer 2 overflow pulses for its transmit clock in serial port modes 1 and 3. tclk = 0 causes timer 1 overflows to be used for the transmit clock. exen2 timer 2 external enable. when set, allows a capture or reload to occur as a result of a negative transition on t2ex if timer 2 is not being used to clock the serial port. exen2 = 0 causes timer 2 to ignore events at t2ex. tr2 start/stop control for timer 2. tr2 = 1 starts the timer. c/t2 timer or counter select for timer 2. c/t2 = 0 for timer function. c/t2 = 1 for external event counter (falling edge triggered). cp/rl2 capture/reload select. cp/rl2 = 1 causes captures to occur on negative transitions at t2ex if exen2 = 1. cp/rl2 = 0 causes automatic reloads to occur when timer 2 overflows or negative transitions occur at t2ex when exen2 = 1. when either rclk or tclk = 1, this bit is ignored and the timer is forced to auto-reload on timer 2 overflow.
16 3286h?micro?9/05 at89s8253 figure 10-1. timer 2 in capture mode 10.3 auto-reload (up or down counter) timer 2 can be programmed to count up or down when configured in its 16-bit auto-reload mode. this feature is invoked by the dcen (down counter enable) bit located in the sfr t2mod (see table 10-3 ). upon reset, the dcen bit is set to 0 so that timer 2 will default to count up. when dcen is set, timer 2 can count up or down, depending on the value of the t2ex pin. figure 10-2 shows timer 2 automatically counting up when dcen = 0. in this mode, two options are selected by bit exen2 in t2con. if exen2 = 0, timer 2 counts up to 0ffffh and then sets the tf2 bit upon overflow. the overflow also causes the timer registers to be reloaded with the 16-bit value in rcap2h and rcap2l. the values in rcap2h and rcap2l are preset by soft- ware. if exen2 = 1, a 16-bit reload can be triggered either by an overflow or by a 1-to-0 transition at external input t2ex. this transition also sets the exf2 bit. both the tf2 and exf2 bits can generate an interrupt if enabled. setting the dcen bit enables timer 2 to count up or down, as shown in figure 10-3 . in this mode, the t2ex pin controls the direction of the count. a logic 1 at t2ex makes timer 2 count up. the timer will overflow at 0ffffh and set the tf2 bit. this overflow also causes the 16-bit value in rcap2h and rcap2l to be reloaded into the timer registers, th2 and tl2, respectively. osc exf2 t2ex pin t2 pin tr2 exen2 c/t2 = 0 c/t2 = 1 control capture overflow control transition detector timer 2 interrupt 12 rcap2l rcap2h th2 tl2 tf2 table 10-3. t2mod ? timer 2 mode control register t2mod address = 0c9h reset value = xxxx xx00b not bit addressable ??????t2oedcen bit76543210 symbol function ? not implemented, reserved for future use. t2oe timer 2 output enable bit. dcen when set, this bit allows timer 2 to be configured as an up/down counter.
17 3286h?micro?9/05 at89s8253 a logic 0 at t2ex makes timer 2 count down. the timer underflows when th2 and tl2 equal the values stored in rcap2h and rcap2l. the underflow sets the tf2 bit and causes 0ffffh to be reloaded into the timer registers. the exf2 bit toggles whenever timer 2 overflows or underflows and can be used as a 17th bit of resolution. in this operating mode, exf2 does not flag an interrupt. figure 10-2. timer 2 in auto reload mode (dcen = 0) figure 10-3. timer 2 auto reload mode (dcen = 1 timer 2 auto reload mode (dcen = 1)
18 3286h?micro?9/05 at89s8253 figure 10-4. timer 2 in baud rate generator mode 11. baud rate generator timer 2 is selected as the baud rate generator by setting tclk and/or rclk in t2con ( table 10-2 ). note that the baud rates for transmit and receive can be different if timer 2 is used for the receiver or transmitter and timer 1 is used for the other function. setting rclk and/or tclk puts timer 2 into its baud rate generator mode, as shown in figure 10-4 . the baud rate generator mode is similar to the auto-reload mode, in that a rollover in th2 causes the timer 2 registers to be reloaded with the 16-bit value in registers rcap2h and rcap2l, which are preset by software. the baud rates in modes 1 and 3 are determined by timer 2?s overflow rate according to the fol- lowing equation. the timer can be configured for either timer or counter operation. in most applications, it is con- figured for timer operation (cp/t2 = 0). the timer operation is different for timer 2 when it is used as a baud rate generator. normally, as a timer, it increments every machine cycle (at 1/12 the oscillator frequency). as a baud rate generator, however, it increments every state time (at 1/2 the oscillator frequency). the baud rate formula is given below. where (rcap2h, rcap2l) is the content of rcap2h and rcap2l taken as a 16-bit unsigned integer. osc smod1 rclk tclk rx clock tx clock t2ex pin t2 pin tr2 control "1" "1" "1" "0" "0" "0" timer 1 overflow note: osc. freq. is divided by 2, not 12 timer 2 interrupt 2 2 16 16 rcap2l rcap2h th2 tl2 c/t2 = 0 c/t2 = 1 exf2 control transition detector exen2 modes 1 and 3 baud rates timer 2 overflow rate 16 ----------------------------------------------------------- - = modes 1 and 3 baud rate --------------------------------------- oscillator frequency 32 65536 rcap2h,rcap2l () ? [] ---------------------------------------------------------------------------------------------- =
19 3286h?micro?9/05 at89s8253 timer 2 as a baud rate generator is shown in figure 10-4 . this figure is valid only if rclk or tclk = 1 in t2con. note that a rollover in th2 does not set tf2 and will not generate an inter- rupt. note too, that if exen2 is set, a 1-to-0 transition in t2ex will set exf2 but will not cause a reload from (rcap2h, rcap2l) to (th2, tl2). thus when timer 2 is in use as a baud rate gen- erator, t2ex can be used as an extra external interrupt. note that when timer 2 is running (tr2 = 1) as a timer in the baud rate generator mode, th2 or tl2 should not be read from or written to. under these conditions, the timer is incremented every state time, and the results of a read or write may not be accurate. the rcap2 registers may be read but should not be written to, because a write might overlap a reload and cause write and/or reload errors. the timer should be turned off (clear tr2) before accessing the timer 2 or rcap2 registers. 12. programmable clock out a 50% duty cycle clock can be programmed to come out on p1.0, as shown in figure 12-1 . this pin, besides being a regular i/o pin, has two alternate functions. it can be programmed to input the external clock for timer/counter 2 or to output a 50% duty cycle clock ranging from 61 hz to 4 mhz (for a 16 mhz operating frequency). to configure the timer/counter 2 as a clock generator, bit c/t2 (t2con.1) must be cleared and bit t2oe (t2mod.1) must be set. bit tr2 (t2con.2) starts and stops the timer. the clock-out frequency depends on the oscillator frequency and the reload value of timer 2 capture registers (rcap2h, rcap2l), as shown in the following equation. in the clock-out mode, timer 2 rollovers will not generate an interrupt. this behavior is similar to when timer 2 is used as a baud-rate generator. it is possible to use timer 2 as a baud-rate gen- erator and a clock generator simultaneously. note, however, that the baud-rate and clock-out frequencies cannot be determined independently from one another since they both use rcap2h and rcap2l. figure 12-1. timer 2 in clock-out mode clock out frequency oscillator frequency 4 65536 rcap2h,rcap2l () ? [] ------------------------------------------------------------------------------------------ - =
20 3286h?micro?9/05 at89s8253 13. uart the uart in the at89s8253 operates the same way as the uart in the at89s51 and at89s52. for more detailed information on the uart operation, please click on the document link below: http://www.atmel.com/dyn/resources/prod_documents/doc4316.pdf 13.1 enhanced uart in addition to all of its usual modes, the uart can perform framing error detection by looking for missing stop bits, and automatic address recognition. the uart also fully supports multiproces- sor communication as does the standard 80c51 uart. when used for framing error detect, the uart looks for missing stop bits in the communication. a missing bit will set the fe bit in the scon register. the fe bit shares the scon.7 bit with sm0 and the function of scon.7 is determined by pcon.6 (smod0). if smod0 is set then scon.7 functions as fe. scon.7 functions as sm0 when smod0 is cleared. when used as fe, scon.7 can only be cleared by software. 13.1.1 automatic address recognition automatic address recognition is a feature which allows the uart to recognize certain addresses in the serial bit stream by using ha rdware to make the comparisons. this feature saves a great deal of software overhead by eliminating the need for the software to examine every serial address which passes by the serial port. this feature is enabled by setting the sm2 bit in scon. in the 9-bit uart modes, mode 2 and mode 3, the receive interrupt flag (ri) will be automatically set when the received byte contains either the ?given? address or the ?broadcast? address. the 9-bit mode requires that the 9th information bit is a 1 to indicate that the received information is an address and not data. the 8-bit mode is called mode 1. in this mode the ri flag will be set if sm2 is enabled and the information received has a valid stop bit following the 8 address bits and the information is either a given or broadcast address. mode 0 is the shift register mode and sm2 is ignored. using the automatic address rec ognition feature allows a master to selectively communicate with one or more slaves by invoking the given slave address or addresses. all of the slaves may be contacted by using the broadcast address. two special function registers are used to define the slave?s address, saddr, and the address mask, saden. saden is used to define which bits in the saddr are to be used and which bits are ?don?t care?. the saden mask can be logically anded with the saddr to create the ?given? address which the master will use for addressing each of the slaves. use of the given address allows multiple slaves to be recognized while excluding others. the following examples will help to show the versatility of this scheme: slave 0 saddr = 1100 0000 saden = 1111 1101 given = 1100 00x0 slave 1 saddr = 1100 0000 saden = 1111 1110 given = 1100 000x
21 3286h?micro?9/05 at89s8253 in the previous example saddr is the same and the saden data is used to differentiate between the two slaves. slave 0 requires a 0 in bit 0 and it ignores bit 1. slave 1 requires a 0 in bit 1 and bit 0 is ignored. a unique address for slave 0 would be 1100 0010 since slave 1 requires a 0 in bit 1. a unique address for sl ave 1 would be 1100 0001 since a 1 in bit 0 will exclude slave 0. both slaves can be selected at the same time by an address which has bit 0 = 0 (for slave 0) and bit 1 = 0 (for slave 1). thus, both could be addressed with 1100 0000. in a more complex system the following could be used to select slaves 1 and 2 while excluding slave 0: slave 0 saddr = 1100 0000 saden = 1111 1001 given = 1100 0xx0 slave 1 saddr = 1110 0000 saden = 1111 1010 given = 1110 0x0x slave 2 saddr = 1110 0000 saden = 1111 1100 given = 1110 00xx in the previous example the differentiation among the 3 slaves is in the lower 3 address bits. slave 0 requires that bit 0 = 0 and it can be uniquely addressed by 1110 0110. slave 1 requires that bit 1 = 0 and it can be uniquely addressed by 1110 and 0101. slave 2 requires that bit 2 = 0 and its unique address is 1110 0011. to select slaves 0 and 1 and exclude slave 2, use address 1110 0100, since it is necessary to make bit 2 = 1 to exclude slave 2. the broadcast address for each slave is created by taking the logical or of saddr and saden. zeros in this result are trended as don?t-cares. in most cases, interpreting the don?t- cares as ones, the broadcast address will be ff hexadecimal. upon reset saddr (sfr address 0a9h) and saden (sfr address 0b9h) are loaded with 0s. this produces a given address of all ?don?t cares? as well as a broadcast address of all ?don?t cares?. this effectively disables the automatic addressing mode and allows the microcontroller to use standard 80c51-type uart drivers which do not make use of this feature.
22 3286h?micro?9/05 at89s8253 notes: 1. smod0 is located at pcon.6. 2. f osc = oscillator frequency. table 13-1. pcon ? power control register pcon address = 87h reset value = 00xx 0000b bit addressable smod1 smod0 ? pof gf1 gf0 pd idl bit7 6543210 symbol function smod1 double baud rate bit. doubles the baud rate of the uart in modes 1, 2, or 3. smod0 frame error select. when smod0 = 1, scon.7 is sm0. when smod0 = 1, scon.7 is fe. note that fe will be set after a frame error regardless of the state of smod0. pof power off flag. pof is set to ?1? during power up (i.e. cold reset). it can be set or reset under software control and is no t affected by rst or bod (i.e. warm resets). gf1, gf0 general-purpose flags pd power-down bit. setting this bit activates power-down operation. idl idle mode bit. setting this bit activates idle mode operation table 13-2. scon ? serial port control register scon address = 98h reset value = 0000 0000b bit addressable sm0/fe sm1 sm2 ren tb8 rb8 t1 ri bit7 6543210 (smod0 = 0/1) (1) symbol function fe framing error bit. this bit is set by the receiver when an invalid stop bit is detected. the fe bit is not cleared by valid frames but should be cleared by software. the smod0 bit must be set to enable access to the fe bit. fe will be set regardless of the state of smod0. sm0 serial port mode bit 0, (smod0 must = 0 to access bit sm0) sm1 serial port mode bit 1 sm2 enables the automatic address recognition feature in modes 2 or 3. if sm2 = 1 then rl will not be set unless the received 9th data bit (rb8) is 1, indicating an address, and the received byte is a given or broadcast address. in mode 1, if sm2 = 1 then rl will not be activated unless a valid stop bit was received, and the received byte is a given or broadcast address. in mode 0, sm2 should be 0. ren enables serial reception. set by software to enable reception. clear by software to disable reception. tb8 the 9th data bit that will be transmitted in modes 2 and 3. set or clear by software as desired. rb8 in modes 2 and 3, the 9th data bit that was received. in mode 1, if sm2 = 0, rb8 is the stop bit that was received. in mode 0, rb8 is not used. ti transmit interrupt flag. set by hardware at the end of the 8th bit time in mode 0, or at the beginning of the stop bit in the other modes, in any serial transmission. must be cleared by software. ri receive interrupt flag. set by hardware at the end of the 8th bit time in mode 0, or halfway through the stop bit time in the other modes, in any serial reception (except see sm2). must be cleared by software. sm0 sm1 mode description baud rate (2) 0 0 0 shift register f osc /12 0 1 1 8-bit uart variable 1029-bit uartf osc /64 or f osc /32 1 1 3 9-bit uart variable
23 3286h?micro?9/05 at89s8253 14. serial peripheral interface the serial peripheral interface (spi) allows high-speed synchronous data transfer between the at89s8253 and peripheral devices or between multiple at89s8253 devices. the at89s8253 spi features include the following:  full-duplex, 3-wire synchronous data transfer  master or slave operation  maximum bit frequency = f/4 (f/2 if in x2 clock mode)  lsb first or msb first data transfer  four programmable bit rates in master mode  end of transmission interrupt flag  write collision flag protection  double-buffered receive  double-buffered transmit (enhanced mode only)  wakeup from idle mode (slave mode only) the interconnection between master and slave cpus with spi is shown in figure 14-1 . the four pins in the interface are master-in/slave-out (miso), master-out/slave-in (mosi), shift clock (sck), and slave select (ss ). the sck pin is the clock output in master mode, but is the clock input in slave mode. the mstr bit in spcr determines the directions of miso and mosi. also notice that mosi connects to mosi and miso to miso. in master mode, ss /p1.4 is ignored and may be used as a general-purpose input or output. in slave mode, ss must be driven low to select an individual device as a slave. when ss is driven high, the slave?s spi port is deacti- vated and the mosi/p1.5 pin can be used as a general-purpose input. figure 14-1. spi master-slave interconnection 8-bit shift register master clock generator spi miso 8-bit shift register slave miso mosi mosi sck sck ss ss v cc msb lsb msb lsb
24 3286h?micro?9/05 at89s8253 figure 14-2. spi block diagram note: 1. the write data buffer is only used in enhanced spi mode. the spi has two modes of operation: normal (non-buffered write) and enhanced (buffered write). in normal mode, writing to the spi data register (spdr) of the master cpu starts the spi clock generator and the data written shifts out of the mosi pin and into the mosi pin of the slave cpu. transmission may start after an initial delay while the clock generator waits for the next full bit slot of the specified baud rate. after shifting one byte, the spi clock generator stops, setting the end of transmission flag (spif) and transferring the received byte to the read buffer (spdr). if both the spi interrupt enable bit (spie) and the serial port interrupt enable bit (es) are set, an interrupt is requested. note that spdr refers to either the write data buffer or the read data buffer, depending on whether the access is a write or read. in normal mode, because the write buffer is transparent (and a write access to spdr will be directed to the shift buffer), any attempt to write to spdr while a transmission is in progress will result in a write collision with wcol set. however, the transmission will still complete normally, but the new byte will be ignored and a new write access to spdr will be necessary. enhanced mode is similar to normal mode except that the write buffer holds the next byte to be transmitted. writing to spdr loads the write buffer and sets wcol to signify that the buffer is full and any further writes will overwrite the buffer. wcol is cleared by hardware when the buff- ered byte is loaded into the shift register and transmission begins. if the master spi is currently idle, i.e. if this is the first byte, then afte r loading spdr, transmission of the byte starts and wcol is cleared immediately. while this byte is transmitting, the next byte may be written to spdr. the load enable flag (lden) in spsr can be used to determine when transmission has started. lden is asserted during the first four bit slots of a spi transfer. the master cpu should first check that lden is set and that wcol is cleared before loading the next byte. in enhanced mode, if wcol is set when a transfer completes, i.e. the next byte is available, then the spi immediately loads the buffered byte into the sh ift register, resets wc ol, and continues trans- mission without stopping and restarting the clock generator. as long as the cpu can keep the write buffer full in this manner, multiple bytes may be transferred with minimal latency between bytes. oscillator 8-bit shift register read data buffer pin contr ol logic spi control spi status register spi interrupt request internal data b u s select spi clock (master) divider 41664128 spi control register 8 8 8 spif wcol spr1 mstr spie clock logic clock msb s m spe dord mstr cpol cpha spr1 spr0 mstr spe dord lsb s m m s miso p1.6 mosi p1.5 sck 1.7 ss p1.4 spr0 spe write data buffer (1)
25 3286h?micro?9/05 at89s8253 notes: 1. set up the clock mode before enabling the spi: set all bits needed in spcr except the spe bit, then set spe. 2. enable the master spi prior to the slave device. 3. slave echoes master on next tx if not loaded with new data. table 14-1. spcr ? spi control register spcr address = d5h reset value = 0000 0100b not bit addressable spie spe dord mstr cpol cpha spr1 spr0 bit76543210 symbol function spie spi interrupt enable. this bit, in conjunction with the es bit in the ie register, enables spi interrupts: spie = 1 and es = 1 enable spi interrupts. spie = 0 disables spi interrupts. spe spi enable. spi = 1 enables the spi channel and connects ss , mosi, miso and sck to pins p1.4, p1.5, p1.6, and p1.7. spi = 0 disables the spi channel. dord data order. dord = 1 selects lsb first data transmission. dord = 0 selects msb first data transmission. mstr master/slave select. mstr = 1 selects master spi mode. mstr = 0 selects slave spi mode. cpol clock polarity. when cpol = 1, sck is high when idle. when cpol = 0, sck of the master device is low when not transmitting. please refer to figure on spi clock phase and polarity control. cpha clock phase. the cpha bit together with the cpol bit controls the clock and data relationship between master and slave. please refer to figure on spi clock phase and polarity control. spr0 spr1 spi clock rate select. these two bits control the sck rate of the device configured as master. spr1 and spr0 have no effect on the slave. the relationship between sck and the oscillator frequency, f osc. , is as follows: spr1 spr0 sck 0 0 f/4 (f/2 in x2 mode) 0 1 f/16 (f/8 in x2 mode) 1 0 f/64 (f/32 in x2 mode) 1 1 f/128 (f/64 in x2 mode)
26 3286h?micro?9/05 at89s8253 table 14-2. spsr ? spi status register spsr address = aah reset value = 000x xx00b not bit addressable spif wcol lden ? ? ? disso enh bit76543210 symbol function spif spi interrupt flag. when a serial transfer is complete, the spif bit is set and an interrupt is generated if spie = 1 and es = 1. the spif bit is cleared by reading the spi status register followed by reading/writing the spi data register. wcol when enh = 0: write collision flag. the wcol bit is set if the spi data register is written during a data transfer. during data transfer, the result of reading the spdr register may be incorrect, and writing to it has no effect. the wcol bit (and the spif bit) are cleared by reading the spi status register followed by reading/writing the spi data register. when enh = 1: wcol works in enhanced mode as tx buffer full. writing during wcol = 1 in enhanced mode will overwrite the waiting data already present in the tx buffer. in this mode, wcol is no longer reset by the spif reset but is reset when the write buffer has been unloaded into the serial shift register. lden load enable for the tx buffer in enhanced spi mode. when enh is set, it is safe to load the tx buffer while lden = 1 and wcol = 0. lden is high during bits 0 - 3 and is low during bits 4 - 7 of the spi serial byte transmission time frame. disso disable slave output bit. when set, this bit causes the miso pin to be tri-stated so more than one slave device can share the same interface with a single master. normally, the first byte in a transmission could be the slave address and only the selected slave should clear its disso bit. enh enhanced spi mode select bit. when enh = 0, spi is in normal mode, i.e. without write double buffering. when enh = 1, spi is in enhanced mode with write double buffering. the tx buffer shares the same address with the spdr register. table 14-3. spdr ? spi data register spdr address = 86h reset value = 00h (after cold reset) unchanged (after warm reset) not bit addressable spd7 spd6 spd5 spd4 spd3 spd2 spd1 spd0 bit76543210
27 3286h?micro?9/05 at89s8253 figure 14-3. spi shift register diagram the cpha (c lock pha se), cpol (c lock pol arity), and spr (s erial p eripheral clock r ate = baud rate) bits in spcr control the shape and rate of sck. the two spr bits provide four possi- ble clock rates when the spi is in master mode. in slave mode, the spi will operate at the rate of the incoming sck as long as it does not exceed the maximum bit rate. there are also four pos- sible combinations of sck phase and polarity with respect to the serial data. cpha and cpol determine which format is used for transmission. the spi data transfer formats are shown in figure 14-4 and figure 14-5 . to prevent glitches on sck from disrupting the interface, cpha, cpol, and spr should be set up before the interface is enabled, and the master device should be enabled before the slave device(s). table 14-4. spi master characteristics symbol parameter min max units t clcl oscillator period 41.6 ns t sck serial clock cycle time 4t clcl ns t shsl clock high time t sck /2 - 25 ns t slsh clock low time t sck /2 - 25 ns t sr rise time 25 ns t sf fall time 25 ns t sis serial input setup time 10 ns t sih serial input hold time 10 ns t soh serial output hold time 10 ns t sov serial output valid time 35 ns 2:1 mux 2:1 mux serial master serial slave latch dq clk latch dq clk latch dq clk latch dq clk parallel slave (read buffer) parallel master (write buffer) serial out receive byte serial in transmit byte 8 8 8 8 7 8
28 3286h?micro?9/05 at89s8253 figure 14-4. spi master timing (cpha = 0) table 14-5. spi slave characteristics symbol parameter min max units t clcl oscillator period 41.6 ns t sck serial clock cycle time 4t clcl ns t shsl clock high time 1.5 t clcl - 25 ns t slsh clock low time 1.5 t clcl - 25 ns t sr rise time 25 ns t sf fall time 25 ns t sis serial input setup time 10 ns t sih serial input hold time 10 ns t soh serial output hold time 10 ns t sov serial output valid time 35 ns t soe output enable time 10 ns t sox output disable time 25 ns t sse slave enable lead time 10 ns t ssd slave disable lag time 0 ns ss sck (cpol = 0) sck (cpol = 1) miso mosi t sr t sck t slsh t slsh t shsl t shsl t soh t sf t sis t sih t sov
29 3286h?micro?9/05 at89s8253 figure 14-5. spi slave timing (cpha = 0) figure 14-6. spi master timing (cpha = 1) figure 14-7. spi slave timing (cpha = 1) t sr t sse t slsh t shsl t sov t sf t sox t ssd t sck t slsh t shsl t soe t soh t sih t sis ss sck (cpol = 0) sck (cpol= 1) miso mosi t shsl t slsh t shsl t slsh t sck t soh t sf t sr t sis t sov t sih ss sck (cpol = 0) sck (cpol = 1) miso mosi ss sck (cpol = 0) sck (cpol = 1) miso mosi t sck t sse t shsl t shsl t slsh t slsh t ssd t sih t sis t soe t sov t soh t sox t sf t sr
30 3286h?micro?9/05 at89s8253 figure 14-8. spi transfer format with cpha = 0 note: *not defined but normally msb of character just received figure 14-9. spi transfer format with cpha = 1 note: *not defined but normally lsb of previously transmitted character 15. interrupts the at89s8253 has a total of six interrupt vectors: two external interrupts (int0 and int1 ), three timer interrupts (timers 0, 1, and 2), and the serial port interrupt. these interrupts are all shown in figure 15-1 . each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in special function register ie. ie also contai ns a global disable bit, ea, which disables all interrupts at once. note that table 15-1 shows that bit position ie.6 is unimplemented. user software should not write a 1 to this bit position, since it may be used in future at89 products. timer 2 interrupt is generated by the logical or of bits tf2 and exf2 in register t2con. nei- ther of these flags is cleared by hardware when the service routine is vectored to. in fact, the service routine may have to determine whether it was tf2 or exf2 that generated the interrupt, and that bit will have to be cleared in software. the serial interrupt is the logical or of bits ri and ti in register scon and also bit spif in spsr (if spie in spcr is set). none of these flags is cleared by hardware when the service rou- tine is vectored to. the service routine may have to determine whether the uart or spi generated the interrupt. msb 6 5 4 3 2 1 lsb 1 2 3 4 5 6 7 8 msb * 65432 1 lsb sck cycle # (for reference) sck (cpol = 0) sck (cpol = 1) mosi (from master) miso (from slave) ss (to slave)
31 3286h?micro?9/05 at89s8253 the timer 0 and timer 1 flags, tf0 and tf1, are set at s5p2 of the cycle in which the timers overflow. the values are then polled by the circuitry in the next cycle. however, the timer 2 flag, tf2, is set at s2p2 and is polled in the same cycle in which the timer overflows. interrupt source vector address system reset rst or por or bod 0000h external interrupt 0 ie0 0003h timer 0 overflow tf0 000bh external interrupt 1 ie1 0013h timer 1 overflow tf1 001bh serial port ri or ti 0023h table 15-1. interrupt enable (ie) register ie address = a8h reset value = 0x00 0000b bit addressable ea ? et2 es et1 ex1 et0 ex0 enable bit = 1 enables the interrupt. enable bit = 0 disables the interrupt. symbol position function ea ie.7 disables all interrupts. if ea = 0, no interrupt is acknowledged. if ea = 1, each interrupt source is individually enabled or disabled by setting or clearing its enable bit. ? ie.6 reserved. et2 ie.5 timer 2 interrupt enable bit. es ie.4 spi and uart interrupt enable bit. et1 ie.3 timer 1 interrupt enable bit. ex1 ie.2 external interrupt 1 enable bit. et0 ie.1 timer 0 interrupt enable bit. ex0 ie.0 external interrupt 0 enable bit. user software should never write 1s to reserved bits, because they may be used in future at89 products.
32 3286h?micro?9/05 at89s8253 . table 15-2. ip ? interrupt priority register ip = b8h reset value = xx00 0000b bit addressable ? ? pt2 ps pt1 px1 pt0 px0 bit76543210 symbol function pt2 timer 2 interrupt priority low ps serial port interrupt priority low pt1 timer 1 interrupt priority low px1 external interrupt 1 priority low pt0 timer 0 interrupt priority low px0 external interrupt 0 priority low table 15-3. iph ? interrupt priority high register iph = b7h reset value = xx00 0000b not bit addressable ? ? pt2h psh pt1h px1h pt0h px0h bit76543210 symbol function pt2h timer 2 interrupt priority high psh serial port interrupt priority high pt1h timer 1 interrupt priority high px1h external interrupt 1 priority high pt0h timer 0 interrupt priority high px0h external interrupt 0 priority high
33 3286h?micro?9/05 at89s8253 figure 15-1. interrupt sources 16. oscillator characteristics xtal1 and xtal2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator, as shown in figure 16-1 . either a quartz crystal or ceramic resonator may be used. to drive the device from an external clock source, xtal2 should be left unconnected while xtal1 is driven, as shown in figure 16-2 . figure 16-1. oscillator connections note: c1, c2 = 5 pf 5 pf for crystals = 5 pf 5 pf for ceramic resonators figure 16-2. external clock drive configuration
34 3286h?micro?9/05 at89s8253 17. idle mode in idle mode, the cpu puts itself to sleep while all the on-chip peripherals remain active. this mode is invoked by software. the content of the on-chip ram and all the special functions regis- ters remain unchanged during this mode. the idle mode can be terminated by any enabled interrupt or by a hardware reset. note that when idle mode is terminated by a hardware reset, the device normally resumes pro- gram execution from where it left off, up to two machine cycles before the internal reset algorithm takes control. on-chip hardware inhibits access to internal ram in this event, but access to the port pins is not inhibited. to e liminate the possibility of an unexpected write to a port pin when idle mode is terminated by a reset, the instruction following the one that invokes idle mode should not write to a port pin or to external memory. 18. power-down mode in the power-down mode, the oscillator is stopped and the instruction that invokes power-down is the last instruction executed. the on-chip ram and special function registers retain their values until the power-down mode is terminated. exit from power-down can be initiated either by a hardware reset or by an enabled external interrupt. reset redefines the sfrs but does not change the on-chip ram. the reset should not be activated before v cc is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize. to exit power-down via an interrupt, external interrupt pin p3.2 or p3.3 must be kept low for at least the specified required crystal oscillator start up time. afterwards, the interrupt service rou- tine starts at the rising edge of the external interrupt pin if the sfr bit auxr.1 is set. if auxr.1 is reset (cleared), execution starts after a self-t imed interval of 2 ms (nominal) from the falling edge of the external interrupt pin. the user should not attempt to enter (or re-enter) the power-down mode for a minimum of 4 s until after one of the following conditions has occurred: start of code execution (after any type of reset), or exit from power-down mode. table 17-1. status of external pins during idle and power-down modes mode program memory ale psen port0 port1 port2 port3 idle internal 1 1 data data data data idle external 1 1 float data address data power-down internal 0 0 data data data data power-down external 0 0 float data data data
35 3286h?micro?9/05 at89s8253 19. program memory lock bits the at89s8253 has three lock bits that can be left unprogrammed (u) or can be programmed (p) to obtain the additional features listed in table 19-1 . when lock bit 1 is programmed, the logic level at the ea pin is sampled and latched during reset. if the device is powered up without a reset, the latch initializes to a random value and holds that value until reset is activated. the latched value of ea must agree with the current logic level at that pin in order for the device to function properly. once programmed, the lock bits can only be unprogrammed with the chip erase operation in either the parallel or serial modes. note: 1. u = unprogrammed p = programmed 20. programming the flash and eeprom atmel?s at89s8253 flash microcontroller offers 12k bytes of in-system reprogrammable flash code memory and 2k bytes of eeprom data memory. the at89s8253 is normally shipped with the on-chip flash code and eeprom data memory arrays in the erased state (i.e. contents = ffh) and ready to be programmed. this device sup- ports a parallel programming mode and a serial programming mode. the serial programming mode provides a convenient way to reprogram the at89s8253 inside the user?s system. the parallel programming mode is compatible with conventional third-party flash or eprom programmers. the code and data memory arrays are mapped via separate address spaces in the parallel and serial programming modes: 0000h to 2fffh for code memory and 000h to 7ffh for data memory. the code and data memory arrays in the at89s8253 are programmed byte-by-byte or by page in either programming mode. to reprogram any non-blank byte in the parallel or serial mode, the user needs to invoke the chip erase operation first to erase both arrays since there is no built-in auto-erase capability. table 19-1. lock bit protection modes (1) program lock bits protection type lb1 lb2 lb3 1 u u u no internal memory lock feature. 2puu movc instructions executed from external program memory are disabled from fetching code bytes from internal memory. ea is sampled and latched on reset and further programming of the flash memory (parallel or serial mode) is disabled. 3 p p u same as mode 2, but parallel or serial verify are also disabled. 4 p p p same as mode 3, but external execution is also disabled.
36 3286h?micro?9/05 at89s8253 parallel programming algorithm: to program and verify the at89s8253 in the parallel pro- gramming mode, the following sequence is recommended (see figure 26-1 ): 1. power-up sequence: a. apply power between v cc and gnd pins. b. set rst pin to ?h?. c. apply a 3 mhz to 24 mhz clock to xtal1 pin and wait for at least 10 ms. 2. set psen pin to ?l? a. ale pin to ?h? b. ea pin to ?h? and all other pins to ?h?. 3. raise ea /vpp to 12v to enable flash programming, erase or verification. enable the p3.0 pull-up (10 k ? typical) for rdy/bsy operation. 4. apply the appropriate combination of ?h? or ?l? logic levels to pins p3.3, p3.4, p3.5, p3.6, p3.7 to select one of the programming operations shown in the flash program- ming modes table. 5. apply the desired byte address to pins p1.0 to p1.7 and p2.0 to p2.5. a. apply data to pins p0.0 to p0.7 for write code operation. 6. pulse ale/prog once to load a byte in the code memory array, the data memory array, or the lock bits. 7. repeat steps 5 and 6, changing the address and data for up to 64 bytes in the code memory page or 32 bytes in the data memory (eeprom) page. when loading a page with individual bytes, the interval between consecutive byte loads should be no longer than 150 s. otherwise the device internally times out and assumes that the page load sequence is completed, rejecting any further loads before the page programming sequence has finished. this timing restriction also applies to page write of the 64-byte user row. 8. after the last byte of the current page has been loaded, wait for 5 ms or monitor the rdy/busy pin until it transitions high. the page write cycle is self-timed and typically takes less than 5 ms. 9. to verify the last byte of the page just programmed, bring pin p3.4 to ?l? and read the programmed data at pins p0.0 to p0.7. 10. repeat steps 4 through 7 changing the address and data for the entire array or until the end of the object file is reached. 11. power-off sequence: a. tri-state the address and data inputs. b. disable the p3.0 pullup used for rdy/busy operation. c. set xtal1 to ?l?. d. set rst and ea pins to ?l?. e. turn v cc power off. data polling: the at89s8253 features data polling to indicate the end of any programming cycle. during a write cycle in the parallel or serial programming mode, an attempted read of the last loaded byte will result in the complement of the written datum on p0.7 (parallel mode), and on the msb of the serial output byte on miso (serial mode). once the write cycle has been com- pleted, true data are valid on all outputs, and the next cycle may begin. data polling may begin any time after a write cycle has been initiated.
37 3286h?micro?9/05 at89s8253 ready/busy : the progress of byte programming in the parallel programming mode can also be monitored by the rdy/bsy output signal. pin p3.0 is pulled low after ale goes high during programming to indicate busy . p3.0 is pulled high again when programming is done to indicate ready. p3.0 needs an external pullup (typical 10 k ? ) when functioning as rdy/bsy . program verify: if lock bits lb1 and lb2 have not been programmed, the programmed code or data byte can be read back via the address and data lines for verification. the state of the lock bits can also be verified directly in the parallel and serial programming modes. chip erase: both flash and eeprom arrays are erased electrically at the same time. in the parallel programming mode, chip erase is initiated by using the proper combination of control signals. the code and data arrays are written with all ?1?s during the chip erase operation. the user row will also be erased if the usrrowproen fuse (fuse3) = 0 (enabled state). in the serial programming mode, a chip erase operation is initiated by issuing the chip erase instruction. in this mode, chip erase is self-timed and also takes about 8 ms. during chip erase, a serial read from any address location will return 00h at the data outputs. serial programming fuse: a programmable fuse is available to disable serial programming if the user needs maximum system security. the serial programming fuse can be enabled/dis- abled in both the parallel/serial programming modes. the at89s8253 is shipped with the serial programming mode enabled. reading the signature bytes: the signature bytes are read by the same procedure as a nor- mal verification of locations 030h and 031h, except that p3.6 and p3.7 must be pulled to a logic low. the values returned are as follows: (030h) = 1eh indicates manufactured by atmel (031h) = 73h indicates at89s8253 21. programming interface every code byte in the flash and eeprom arra ys can be written, and th e entire array can be erased, by using the appropriate combination of control signals. the write operation cycle is self- timed and once initiated, will automatically time itself to completion. most worldwide major programming vendors offer support for the atmel at89 microcontroller series. please contact your local programming vendor for the appropriate software revision. 22. serial downloading both the code and data memory arrays can be programmed using the serial spi bus while rst is pulled to v cc . the serial interface consists of pins sck, mosi (input) and miso (output). after rst is set high, the programming enable instruction must be executed first before other opera- tions can be executed. the chip erase operation turns the content of every memory location in both the code and data arrays into ffh. the code and data memory arrays have separate address spaces: 0000h to 2fffh for code memory and 000h to 7ffh for data memory. either an external system clock is supplied at pin xtal1 or a crystal needs to be connected across pins xtal1 and xtal2. the maximum serial clock (sck) frequency should be less than 1/16 of the crystal frequency. with a 24 mhz os cillator clock, the maximum sck frequency is 1.5 mhz.
38 3286h?micro?9/05 at89s8253 23. serial programming algorithm to program and verify the at89s8253 in the serial programming mode, the following sequence is recommended: 1. power-up sequence: a. apply power between vcc and gnd pins. b. set rst pin to ?h?. if a crystal is not connected across pins xtal1 and xtal2, apply a 3 mhz to 24 mhz clock to xtal1 pin and wait for at least 10 ms with rst pin high and p1.7 (sck) low. 2. enable serial programming by sending the programming enable serial instruction to pin mosi/p1.5. the frequency of the shift clock supplied at pin sck/p1.7 needs to be less than the cpu clock at xtal1 divided by 16. 3. the code or data array is programmed one byte or one page at a time by supplying the address and data together with the appropriate write instruction. the write cycle is self- timed and typically takes less than 4.0 ms at 5v. 4. any memory location can be verified by using the read instruction which returns the content at the selected address at serial output miso/p1.6. 5. at the end of a programming session, rst can be set low to commence normal operation. power-off sequence (if needed): 1. set xtal1 to ?l? (if a crystal is not used). 2. set rst to ?l?. 3. turn v cc power off.
39 3286h?micro?9/05 at89s8253 24. serial programming instruction the instruction set for serial programming follows a 4-byte protocol and is shown in table 24-1 . after reset signal is high, sck should be low for at least 64 system clocks before it goes high to clock in the enable data bytes. no pulsing of reset signal is necessary. sck should be no faster than 1/16 of the system clock at pin xtal1. for page read/write, the data always starts from byte 0 to 31 or 63. after the command byte and upper address byte are latched, each byte thereafter is treated as data until all 32 or 64 bytes are shifted in/out. then the next instruction will be ready to be decoded. table 24-1. serial programming instruction set instruction instruction format operation byte 1 byte 2 byte 3 byte 4 byte n programming enable 1010 1100 0101 0011 xxxx xxxx xxxx xxxx enable serial programming while rst is high chip erase 1010 1100 100x xxxx xxxx xxxx xxxx xxxx chip erase both the 12k and 2k memory arrays write program memory ( byte mode) 0100 0000 xx write data to program memory ? byte mode read program memory ( byte mode) 0010 0000 xx read data from program memory ? byte mode write program memory ( page mode) 0101 0000 xx 00 0000 byte 0 ... byte 63 write data to program memory ? page mode (64 bytes) read program memory ( page mode) 0011 0000 xx 00 0000 byte 0 ... byte 63 read data from program memory ? page mode (64 bytes) write data memory ( byte mode) 1100 0000 xxxx x write data to data memory ? byte mode read data memory ( byte mode) 1010 0000 xxxx x read data from data memory ? byte mode write data memory ( page mode) 1101 0000 xxxx x 0 0000 byte 0 ... byte 31 write data to data memory ? page mode (32 bytes) read data memory ( page mode) 1011 0000 xxxx x 0 0000 byte 0 ... byte 31 read data from data memory ? page mode (32 bytes) write user fuses 1010 1100 0001 xxxx xxxx xxxx xxxx write user fuse bits (refer to next page for the fuse definitions) read user fuses 0010 0001 xxxx xxxx xxxx xxxx xxxx read back status of user fuse bits write lock bits 1010 1100 1110 0 xxxx xxxx xxxx xxxx write the lock bits (write a ?0? to lock) read lock bits 0010 0100 xxxx xxxx xxxx xxxx xxxx x read back current status of the lock bits (a programmed lock bit reads back as a ?0?) write user sgn. byte 0100 0010 xxxx xxxx xx read user sgn. byte 0010 0010 xxxx xxxx xx write user sgn. page 0101 0010 xxxx xxxx xxxx xxxx byte 0 ... byte 63 read user sgn. page 0011 0010 xxxx xxxx xxxx xxxx byte 0 ... byte 63 read atmel sgn. byte 0010 1000 xxxx xxxx xx read signature byte a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 d7 d6 d5 d4 d3 d2 d1 d0 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 d7 d6 d5 d4 d3 d2 d1 d0 a13 a12 a11 a10 a9 a8 a7 a6 a13 a12 a11 a10 a9 a8 a7 a6 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 d7 d6 d5 d4 d3 d2 d1 d0 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 d7 d6 d5 d4 d3 d2 d1 d0 a10 a9 a8 a7 a6 a5 a10 a9 a8 a7 a6 a5 fuse4 fuse3 fuse2 fuse1 fuse4 fuse3 fuse2 fuse1 lb3 lb2 lb1 lb3 lb2 lb1 a5 a4 a3 a2 a1 a0 d7 d6 d5 d4 d3 d2 d1 d0 a5 a4 a3 a2 a1 a0 d7 d6 d5 d4 d3 d2 d1 d0 a5 a4 a3 a2 a1 a0 d7 d6 d5 d4 d3 d2 d1 d0
40 3286h?micro?9/05 at89s8253 notes: 1. see detailed timing for serial programming mode. 2. internally timed for 8.0 ms. 3. internally timed for 8.0 ms. programming begins 150 s (minimum) after the last write pulse. 4. p3.0 is pulled low during programming to indicate rdy/bsy 5. 1 to 64 bytes can be programmed at a time per page. 6. 1 to 32 bytes can be programmed at a time per page. 25. flash and eeprom parallel programming modes mode rst psen ale ea p3.3 p3.4 p3.5 p3.6 p3.7 data i/o p0.7:0 address p2.5:0, p1.7:0 serial prog. modes (1) hh h chip erase (2) h l 1.0 s 12v h l h l l x x page write (3)(4)(5) 12k code h l 1.0 s 12vlhhhh di addr read 12k code h l h 12v l l h h h do addr page write (3)(4)(6) 2k data h l 1.0 s 12v l h l h h di addr read 2k data h l h 12v l l l h h do addr write lock bits (2)(4) bit - 1 h l 1.0 s 12v h l h h l d0 = 0 x bit - 2 d1 = 0 x bit - 3 d2 = 0 x read lock bits bit - 1 h l h 12v h h h l l d0 x bit - 2 d1 x bit - 3 d2 x page write (3)(4)(5) user row h l 1.0 s 12v h l h h h di 0 - 3fh read user row h l h 12v l l h l h do 0 - 3fh read sig. row h l h 12v l l h l l do 0 - 3fh write fuse (2)(4) fuse1 serialprgen h l 1.0 s 12v l h h l h d0 = 0 x serialprgdis d0 = 1 x fuse2 x2 clocken d1 = 0 x x2 clockdis d1 = 1 x fuse3 usrrowprgen d2 = 0 x usrrowprgdis d2 = 1 x fuse4 external clock en d3 = 0 x crystal clock en d3 = 1 x read fuse serialprg (fuse1) h l h 12v h h h l h d0 x x2 clock (fuse2) d1 x usrrow prg (fuse3) d2 x clock select (fuse4) d2 x } } } }
41 3286h?micro?9/05 at89s8253 figure 25-1. programming the flash/eeprom memory (parallel mode) figure 25-2. verifying the flash/eeprom memory (parallel mode) p1 p3.3 p3.5 p2.0 - p2.5 a0 - a7 addr. 0000h/37ffh see flash programming modes table 3-24 mhz a8 - a13 p0 p3.4 pgm data prog v pp v ih ale p3.6 p3.7 xtal2 ea rst psen xtal1 gnd v cc at89s8253 p3.0 rdy/bsy (use 10k pullup) v cc p1 p3.3 p3.5 p2.0 - p2.5 a0 - a7 addr. 0000h/37ffh see flash programming modes table a8 - a13 p0 p3.4 pgm data prog v pp v ih ale p3.6 p3.7 ea rst psen xtal1 3-12 mhz external clock gnd v cc at89s8253 p3.0 rdy/bsy (use 10k pullup) v cc oscillator bypass fuse (fuse4) off oscillator bypass fuse (fuse4) on p1 p3.3 p3.5 p2.0 - p2.5 a0-a7 addr. 0000h/37ffh see flash programming modes table 3-24 mhz a8 - a13 p0 v cc p3.4 pgm data (use 10k pullups) v i h v i h ale p3.6 p3.7 xtal2 ea rst psen xtal1 gnd v cc at89s8253 v pp p1 p3.3 p3.5 p2.0 - p2.5 a0 - a7 addr. 0000h/37ffh see flash programming modes table a8 - a13 p0 v cc p3.4 pgm data (use 10k pullups) v i h v i h ale p3.6 p3.7 ea rst psen xtal1 gnd v cc at89s8253 v pp 3-12 mhz external clock oscillator bypass fuse (fuse4) off oscillator bypass fuse (fuse4) on
42 3286h?micro?9/05 at89s8253 figure 25-3. flash/eeprom serial downloading p1.7/sck data output instruction input clock in 3-24 mhz 2.7v to 5.5v p1.5/mosi v ih xtal2 rst xtal1 gnd v cc at89s8253 p1.6/miso p1.7/sck data output instruction input clock in 2.7v to 5.5v p1.5/mosi v ih rst xtal1 gnd v cc at89s8253 p1.6/miso 3-12 mhz external clock oscillator bypass fuse (fuse4) off oscillator bypass fuse (fuse4) on
43 3286h?micro?9/05 at89s8253 notes: 1. power on occurs once v cc reaches 2.4v. 2. 9 ms if chip erase. 26. flash programming and verification characteristics ? parallel mode t a = 20c to 30c, v cc = 4.0v to 5.5v symbol parameter min max units v pp programming enable voltage 11.5 12.5 v i pp programming enable current 1.0 ma 1/t clcl oscillator frequency 3 24 mhz t pwrup power on to rst high (1) 10 s t rhx rst high to xtal start 10 s t ostl oscillator settling time 10 ms t hstl high voltage settling time 10 s t mstp mode setup to prog low 1 s t astp address setup to prog low 1 s t dstp data setup to prog low 1 s t pgw prog width 1 s t ahld address hold after prog 1s t dhld data hold after prog 1s t blt byte load period 1 150 s t phbl prog high to busy low 256 s t wc write cycle time (2) 4.5 ms t mhld mode hold after busy low 10 s t vfy address to data verify valid 1 s t pstp prog setup to v pp high 10 s t phld prog hold after v pp low 10 s t plx prog low to xtal halt 1 s t xrl xtal halt to rst low 1 s t pwrdn rst low to power off 1 s
44 3286h?micro?9/05 at89s8253 figure 26-1. flash/eeprom programming and verification waveforms ? parallel mode v cc rst xtal 1 psen ea/v pp ale/prog p3.3...p3.7 p1.0...p1.7 and p2.0...p2.5 port 0 p3.0 (rdy/bsy) t pwrdn running at 3 mhz t ostl t hstl t mstp t pgw t astp t pstp t dstp t ahld t dhld t blt t mhld t mstp t vfy t xrl t plx t phld t wc t phbl addr0 addr1 data0 data1 addr0 addr1 data0 data1 t pwrup t rhx
45 3286h?micro?9/05 at89s8253 27. serial downloading waveforms (spi mode 1 ??> cpol = 0, cpha = 1) 28. serial programming characteristics figure 28-1. serial programming timing table 28-1. serial programming characteristics, t a = -40 c to 85 c, v cc = 2.7v - 5.5v (unless otherwise noted) symbol parameter min typ max units 1/t clcl oscillator frequency 3 24 mhz t clcl oscillator period 41.6 33.3 ns t shsl sck pulse width high 8 t clcl ns t slsh sck pulse width low 8 t clcl ns t ovsl mosi setup to sck low t clcl ns t shox mosi hold after sck low 2 t clcl ns t shiv sck high to miso valid 10 16 32 ns t erase chip erase instruction cycle time 9 ms t swc serial page write cycle time 4.5 ms serial data input sck/p1.7 mosi/p1.5 miso/p1.6 serial data output 0 1 2 3 4 5 6 7 msb msb lsb lsb sck miso mosi t ovsl shiv t shsl t slsh t shox t change outputs sample inputs
46 3286h?micro?9/05 at89s8253 notes: 1. under steady state (non-transient) conditions, i ol must be externally limited as follows: maximum i ol per port pin: 10 ma, maximum i ol per 8-bit port:15 ma, maximum total i ol for all output pins: 71 ma if i ol exceeds the test condition, v ol may exceed the related specification. pins are not guaranteed to sink current greater than the listed test conditions. 2. minimum v cc for power-down is 2v. 29. absolute maximum ratings* operating temperature.................................. -55c to +125c *notice: stresses beyond those listed under ?absolute maximum ratings? may cause permanent dam- age to the device. this is a stress rating only and functional operation of the device at these or any other conditions beyond those indicated in the operational sections of this specification is not implied. exposure to absolute maximum rating conditions for extended periods may affect device reliability. storage temperature ..................................... -65c to +150c voltage on any pin with respect to ground .....................................-1.0v to +7.0v maximum operating voltage ............................................ 6.6v dc output current...................................................... 15.0 ma 30. dc characteristics the values shown in this table are valid for t a = -40c to 85c and v cc = 2.7 to 5.5v, unless otherwise noted symbol parameter condition min max v il input low-voltage (except ea ) -0.5v 0.2 v cc - 0.1v v il1 input low-voltage (ea ) -0.5v 0.2 v cc - 0.3v v ih input high-voltage (except xtal1, rst) 0.2 v cc + 0.9v v cc + 0.5v v ih1 input high-voltage (xtal1, rst) 0.7 v cc v cc + 0.5v v ol output low-voltage (1) i ol = 10 ma, v cc = 4.0v, t a = 85c 0.5v v oh output high-voltage when weak pull ups are enabled (ports 1, 2, 3, ale, psen ) i oh = -60 a, t a = 85c 2.4v i oh = -25 a, t a = 85c 0.75 v cc i oh = -10 a, t a = 85c 0.9 v cc v oh1 output high-voltage when strong pull ups are enabled (port 0 in external bus mode, p1, 2, 3, ale, psen ) i oh = -40 ma, t a = 85c 2.4v i oh = -25 ma, t a = 85c 0.75 v cc i oh = -10 ma, t a = 85c 0.9 v cc i il logical 0 input current (ports 1, 2, 3) v in = 0.45v, v cc = 5.5v, t a = -40c -50 a i tl logical 1 to 0 transition current (ports 1, 2, 3) v in = 2v, v cc = 5.5v, t a = -40c -352 a i li input leakage current (port 0, ea ) 0.45v< v in < v cc 10 a rrst reset pull-down resistor 50 k ? 150 k ? c io pin capacitance test freq. = 1 mhz, t a = 25c 10 pf i cc power supply current active mode, 12 mhz, v cc = 5.5v, t a = -40c 10 ma idle mode, 12 mhz, v cc = 5.5v, t a = -40c 3.5 ma power-down mode (2) v cc = 5.5v, t a = -40c 100 a v cc = 4.0v, t a = -40c 20 a
47 3286h?micro?9/05 at89s8253 31. ac characteristics the values shown in this table are valid for t a = -40c to 85c and v cc = 2.7 to 5.5v, unless otherwise noted. under operating conditions, load capacitance for port 0, ale/prog , and psen = 100 pf; load capacitance for all other outputs = 80 pf. 31.1 external program and data memory characteristics symbol parameter variable oscillator units min max 1/t clcl oscillator frequency 0 24 mhz t lhll ale pulse width 2t clcl - 12 ns t avll address valid to ale low t clcl - 12 ns t llax address hold after ale low t clcl - 16 ns t lliv ale low to valid instruction in 4t clcl - 50 ns t llpl ale low to psen low t clcl - 12 ns t plph psen pulse width 3t clcl - 12 ns t pliv psen low to valid instruction in 3t clcl - 50 ns t pxix input instruction hold after psen -10 ns t pxiz input instruction float after psen t clcl - 20 ns t pxav psen to address valid t clcl - 4 ns t aviv address to valid instruction in 5t clcl - 50 ns t plaz psen low to address float 20 ns t rlrh rd pulse width 6t clcl ns t wlwh wr pulse width 6t clcl ns t rldv rd low to valid data in 5t clcl - 50 ns t rhdx data hold after rd 0ns t rhdz data float after rd 2t clcl - 20 ns t lldv ale low to valid data in 8t clcl - 50 ns t avdv address to valid data in 9t clcl - 50 ns t llwl ale low to rd or wr low 3t clcl - 24 3t clcl ns t avwl address to rd or wr low 4t clcl - 12 ns t qvwx data valid to wr transition 2t clcl - 24 ns t qvwh data valid to wr high 8t clcl - 24 ns t whqx data hold after wr 2t clcl - 24 ns t rlaz rd low to address float 0ns t whlh rd or wr high to ale high t clcl - 10 t clcl + 20 ns
48 3286h?micro?9/05 at89s8253 32. external program memory read cycle 33. external data memory read cycle
49 3286h?micro?9/05 at89s8253 34. external data memory write cycle 35. external clock drive waveforms 36. external clock drive symbol parameter v cc = 2.7v to 5.5v units min max 1/t clcl oscillator frequency 0 24 mhz t clcl clock period 41.6 ns t chcx high time 12 ns t clcx low time 12 ns t clch rise time 5ns t chcl fall time 5ns
50 3286h?micro?9/05 at89s8253 38. shift register mode timing waveforms 39. ac testing input/output waveforms (1) note: 1. ac inputs during testing are driven at v cc - 0.5v for a logic 1 and 0.45v for a logic 0. timing measurements are made at v ih min. for a logic 1 and v il max. for a logic 0. 40. float waveforms (1) note: 1. for timing purposes, a port pin is no longer floating when a 100 mv change from load voltage occurs. a port pin begins t o float when a 100 mv change from the loaded v oh /v ol level occurs. 37. serial port timing: shift register mode test conditions the values in this table are valid for v cc = 2.7v to 5.5v and load capacitance = 80 pf. symbol parameter variable oscillator units min max t xlxl serial port clock cycle time 12t clcl -15 s t qvxh output data setup to clock rising edge 10t clcl -15 ns t xhqx output data hold after clock rising edge 2t clcl -15 ns t xhdx input data hold after clock rising edge t clcl ns t xhdv input data valid to clock rising edge 0 ns
51 3286h?micro?9/05 at89s8253 41. i cc test condition, active mode, all other pins are disconnected 42. i cc test condition, idle mode, all other pins are disconnected 43. clock signal waveform for i cc tests in active and idle modes, t clch = t chcl = 5 ns 44. i cc test condition, power-down mode, all other pins are disconnected, v cc = 2v to 5.5v xtal2 rst v cc v cc v cc i cc xtal1 p0 ea v ss (nc) clock signal xtal2 rst v cc v cc v cc i cc xtal1 p0 ea v ss (nc) clock signal v cc - 0.5v 0.45v 0.2 v cc - 0.1v 0.7 v cc t chcx t chcx t clch t chcl t clcl xtal2 rst v cc v cc v cc i cc xtal1 p0 ea vss (nc)
52 3286h?micro?9/05 at89s8253 45. i cc (active mode) measurements at 8 9 s8 25 3 i cc act iv e @ 25 o c 1.50 2.00 2.50 3 .00 3 .50 4.00 12 3 4567 8 9101112 fr e qu ency (mhz) i c c ) a m ( e v i t c a 3 .0v 4.0v 5.0v x1 mode with intern a l clock o s cill a tor at 8 9 s8 25 3 i cc act iv e @ 90 o c 1.50 2.00 2.50 3 .00 3 .50 4.00 12 3 4567 8 9101112 fr e qu ency (mhz) i c c ) a m ( e v i t c a 3 .0v 4.0v 5.0v x1 mode with intern a l clock o s cill a tor
53 3286h?micro?9/05 at89s8253 46. i cc (idle mode) measurements 47. i cc (power down mode) measurements at 8 9 s8 25 3 i cc idle v s . fre qu ency, t = 25c 0 0.5 1 1.5 2 2.5 3 0 5 10 15 20 25 fre qu ency (mhz) i c c ) a m ( vcc= 3 v vcc=4v vcc=5v x1 mode with intern a l clock o s cill a tor at89s8253 i cc in power-down 0 0.5 1 1.5 2 2.5 1234567 v cc (v) i cc pwd (ua) 0 deg c 25 deg c 90 deg c
54 3286h?micro?9/05 at89s8253 48. ordering information 48.1 standard package speed (mhz) power supply ordering code package operation range 24 2.7v to 5.5v at89s8253-24ac at89s8253-24jc at89s8253-24pc AT89S8253-24SC 44a 44j 40p6 42ps6 commercial (0 c to 70 c) 2.7v to 5.5v at89s8253-24ai at89s8253-24ji at89s8253-24pi at89s8253-24si 44a 44j 40p6 42ps6 industrial (-40 c to 85 c) 48.2 green package option (pb/halide-free) speed (mhz) power supply ordering code package operation range 24 2.7v to 5.5v at89s8253-24au at89s8253-24ju at89s8253-24pu at89s8253-24su 44a 44j 40p6 42ps6 industrial (-40 c to 85 c) package type 44a 44-lead, thin plastic gull wing quad flat package (tqfp) 44j 44-lead, plastic j-leaded chip carrier (plcc) 40p6 40-lead, 0.600" wide, plastic dual inline package (pdip) 42ps6 42-lead, 0.600" wide, plastic dual inline package (pdip)
55 3286h?micro?9/05 at89s8253 49. package information 49.1 44a ? tqfp 2325 orchard parkway san jose, ca 95131 title drawing no. r rev. 44a, 44-lead, 10 x 10 mm body size, 1.0 mm body thickness, 0.8 mm lead pitch, thin profile plastic quad flat package (tqfp) b 44a 10/5/2001 pin 1 identifier 0?~7? pin 1 l c a1 a2 a d1 d e e1 e b common dimensions (unit of measure = mm) symbol min nom max note notes: 1. this package conforms to jedec reference ms-026, variation acb. 2. dimensions d1 and e1 do not include mold protrusion. allowable protrusion is 0.25 mm per side. dimensions d1 and e1 are maximum plastic body size dimensions including mold mismatch. 3. lead coplanarity is 0.10 mm maximum. a ? ? 1.20 a1 0.05 ? 0.15 a2 0.95 1.00 1.05 d 11.75 12.00 12.25 d1 9.90 10.00 10.10 note 2 e 11.75 12.00 12.25 e1 9.90 10.00 10.10 note 2 b 0.30 ? 0.45 c 0.09 ? 0.20 l 0.45 ? 0.75 e 0.80 typ
56 3286h?micro?9/05 at89s8253 49.2 44j ? plcc notes: 1. this package conforms to jedec reference ms-018, variation ac. 2. dimensions d1 and e1 do not include mold protrusion. allowable protrusion is .010"(0.254 mm) per side. dimension d1 and e1 include mold mismatch and are measured at the extreme material condition at the upper or lower parting line. 3. lead coplanarity is 0.004" (0.102 mm) maximum. a 4.191 ? 4.572 a1 2.286 ? 3.048 a2 0.508 ? ? d 17.399 ? 17.653 d1 16.510 ? 16.662 note 2 e 17.399 ? 17.653 e1 16.510 ? 16.662 note 2 d2/e2 14.986 ? 16.002 b 0.660 ? 0.813 b1 0.330 ? 0.533 e 1.270 typ common dimensions (unit of measure = mm) symbol min nom max note 1.14(0.045) x 45? pin no. 1 identifier 1.14(0.045) x 45? 0.51(0.020)max 0.318(0.0125) 0.191(0.0075) a2 45? max (3x) a a1 b1 d2/e2 b e e1 e d1 d 44j , 44-lead, plastic j-leaded chip carrier (plcc) b 44j 10/04/01 2325 orchard parkway san jose, ca 95131 title drawing no. r rev.
57 3286h?micro?9/05 at89s8253 49.3 40p6 ? pdip 2325 orchard parkway san jose, ca 95131 title drawing no. r rev. 40p6 , 40-lead (0.600"/15.24 mm wide) plastic dual inline package (pdip) b 40p6 09/28/01 pin 1 e1 a1 b ref e b1 c l seating plane a 0o ~ 15o d e eb common dimensions (unit of measure = mm) symbol min nom max note a ? ? 4.826 a1 0.381 ? ? d 52.070 ? 52.578 note 2 e 15.240 ? 15.875 e1 13.462 ? 13.970 note 2 b 0.356 ? 0.559 b1 1.041 ? 1.651 l 3.048 ? 3.556 c 0.203 ? 0.381 eb 15.494 ? 17.526 e 2.540 typ notes: 1. this package conforms to jedec reference ms-011, variation ac. 2. dimensions d and e1 do not include mold flash or protrusion. mold flash or protrusion shall not exceed 0.25 mm (0.010").
58 3286h?micro?9/05 at89s8253 49.4 42ps6 ? pdip 2325 orchard parkway san jose, ca 95131 title drawing no. r rev. 42ps6 , 42-lead (0.600"/15.24 mm wide) plastic dual inline package (pdip) a 42ps6 11/6/03 pin 1 e1 a1 b ref e b1 c l seating plane a 0o ~ 15o d e eb common dimensions (unit of measure = mm) symbol min nom max note a ? ? 4.83 a1 0.51 ? ? d 36.70 ? 36.96 note 2 e 15.24 ? 15.88 e1 13.46 ? 13.97 note 2 b 0.38 ? 0.56 b1 0.76 ? 1.27 l 3.05 ? 3.43 c 0.20 ? 0.30 eb ? ? 18.55 e 1.78 typ notes: 1. this package conforms to jedec reference ms-011, variation ac. 2. dimensions d and e1 do not include mold flash or protrusion. mold flash or protrusion shall not exceed 0.25 mm (0.010").
printed on recycled paper. 3286h?micro?9/05 xm disclaimer: the information in this document is provided in connection wit h atmel products. no license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this docum ent or in connection with the sale of atmel products. except as set forth in atmel?s terms and condi- tions of sale located on atmel?s web site, atmel assumes no li ability whatsoever and disclaims any express, implied or statutor y warranty relating to its products including, but not limited to, the implied warranty of merchantability, fitness for a particu lar purpose, or non-infringement. in no event shall atmel be liable for any direct, indirect, conseque ntial, punitive, special or i nciden- tal damages (including, without limitation, damages for loss of profits, business interruption, or loss of information) arising out of the use or inability to use this document, even if atmel has been advised of the possibility of such damages. atmel makes no representations or warranties with respect to the accuracy or co mpleteness of the contents of this document and reserves the ri ght to make changes to specifications and product descriptions at any time without notice. atmel does not make any commitment to update the information contained her ein. unless specifically provided otherwise, atmel products are not suitable for, and shall not be used in, automotive applications. atmel?s products are not int ended, authorized, or warranted for use as components in applications intended to support or sustain life. atmel corporation atmel operations 2325 orchard parkway san jose, ca 95131, usa tel: 1(408) 441-0311 fax: 1(408) 487-2600 regional headquarters europe atmel sarl route des arsenaux 41 case postale 80 ch-1705 fribourg switzerland tel: (41) 26-426-5555 fax: (41) 26-426-5500 asia room 1219 chinachem golden plaza 77 mody road tsimshatsui east kowloon hong kong tel: (852) 2721-9778 fax: (852) 2722-1369 japan 9f, tonetsu shinkawa bldg. 1-24-8 shinkawa chuo-ku, tokyo 104-0033 japan tel: (81) 3-3523-3551 fax: (81) 3-3523-7581 memory 2325 orchard parkway san jose, ca 95131, usa tel: 1(408) 441-0311 fax: 1(408) 436-4314 microcontrollers 2325 orchard parkway san jose, ca 95131, usa tel: 1(408) 441-0311 fax: 1(408) 436-4314 la chantrerie bp 70602 44306 nantes cedex 3, france tel: (33) 2-40-18-18-18 fax: (33) 2-40-18-19-60 asic/assp/smart cards zone industrielle 13106 rousset cedex, france tel: (33) 4-42-53-60-00 fax: (33) 4-42-53-60-01 1150 east cheyenne mtn. blvd. colorado springs, co 80906, usa tel: 1(719) 576-3300 fax: 1(719) 540-1759 scottish enterprise technology park maxwell building east kilbride g75 0qr, scotland tel: (44) 1355-803-000 fax: (44) 1355-242-743 rf/automotive theresienstrasse 2 postfach 3535 74025 heilbronn, germany tel: (49) 71-31-67-0 fax: (49) 71-31-67-2340 1150 east cheyenne mtn. blvd. colorado springs, co 80906, usa tel: 1(719) 576-3300 fax: 1(719) 540-1759 biometrics/imaging/hi-rel mpu/ high speed converters/rf datacom avenue de rochepleine bp 123 38521 saint-egreve cedex, france tel: (33) 4-76-58-30-00 fax: (33) 4-76-58-34-80 literature requests www.atmel.com/literature ? atmel corporation 2005 . all rights reserved. atmel ? , logo and combinations thereof, everywhere you are ? and others, are registered trademarks or trademarks of atmel corporation or it s subsidiaries. other terms and product names may be trademarks o f others.


▲Up To Search▲   

 
Price & Availability of AT89S8253-24SC

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X